﻿package little.bunny.create_dh;

import java.util.ArrayList;
import java.util.List;

import lst.resolution.StringResolution;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Handler;
//import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
//import android.view.View.OnClickListener;
//import android.view.ViewGroup.LayoutParams;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
//import android.widget.AdapterView.OnItemSelectedListener;
//import android.widget.Button;
//import android.widget.LinearLayout;
import android.widget.ListView;
//import android.widget.ProgressBar;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
//import android.widget.TextView;
import android.widget.Toast;
import little.bunny.ContentActivity;
import little.bunny.R;
import little.bunny.ShopContentActivity;
import little.bunny.adapter.List_Adapter;
import little.bunny.bean.SortS;
import little.bunny.server.GetSource;

public class CreateDaoHang implements OnScrollListener {
	private Context myContext;
	private RadioButton myRadioButton;
	private ListView myListView;
	private ArrayList<SortS> myArrayList_SortS;
	private RadioGroup myRadioGroup;
	private View myView;
	private String url;
	
	
	/////////
	//private ProgressBar mProgressBar;
	//private  TextView mTextView;
	//private View MoreView;
    
	//private int Biaoji;
	
    int visibleItemCount;// 当前可见页面中的Item总数
    int scrollState;// 全局变量，用来记录ScrollView的滚动状态，1表示开始滚动，2表示正在滚动，0表示滚动停止
    ////////////////private ListViewAdapter mListViewAdapter = new ListViewAdapter();
    private List_Adapter myList_Adapter=new List_Adapter();
   ////////////////// private Test_List_Adapter test_List_Adapter=new Test_List_Adapter();
   //////////////////////////////// private ArrayList<String[]> strVList;
     private ArrayList<String[]> strV; 
    
    
    //private String MoreUrl=null;
    ////////////////////////////private ArrayList<String> strList=new ArrayList<String>();
	
    /**
     * 抓取时候的页面配置
     */
    //最新资讯
    private String zx_moban="<a href=\"&need;\".*?>&need;</a>.*?<td.*?>&need;</td>", zx_start="<div class=\"hr\" >",zx_end="<div class=\"kong\"></div>";
    private int zx_s=1,zx_d=1,zx_num1=1,zx_num2=2,zx_xml_id=R.layout.nei_list_items;
    
    //服务网点
    private String wd_moban="<td width=\"50%\"><div class=\"hr\">&nbsp;&need;</div></td>.*?<td width=\"20%\" bgcolor=\"#ECECEC\"><div class=\"hr\">&nbsp;&need;</div></td>.*?<td width=\"10%\"><div class=\"hr\">&nbsp;<a href=\"&need;\" title=\"&need;\">"
    		, wd_start="<td width=\"10%\"></td>",wd_end="<div class=\"kong\"></div>";
    private int wd_s=1,wd_d=1,wd_num1=3,wd_num2=0,wd_xml_id=R.layout.list_lists_items;
    //洗涤价格
    private String jg_moban="<TD.*?BACKGROUND: #c1c1c1;.*?><P.*?><SPAN.*?>&need;</SPAN></P></TD><TD.*?BACKGROUND: #dedede;.*?><P.*?><SPAN.*?>&need;</SPAN></P></TD>"
    		, jg_start="<TR style=\"HEIGHT: 18.75pt; mso-yfti-irow: 1\">",jg_end="</TR></TBODY></TABLE>";
    private int jg_s=1,jg_d=1,jg_num1=0,jg_num2=1,jg_xml_id=R.layout.values_lists_items;
    /*"<TD.*?BACKGROUND: #c1c1c1;.*?><P.*?><SPAN.*?>&need;</SPAN></P></TD><TD.*?BACKGROUND: #dedede;.*?><P.*?><SPAN.*?>&need;</SPAN></P></TD>",
	"<TR style=\"HEIGHT: 18.75pt; mso-yfti-irow: 1\">",
	1, "</TR></TBODY></TABLE>", 1, 0, 1,
	R.layout.values_lists_items,*/
   
    
    
	private Handler myHandler = new Handler();

	public CreateDaoHang(Context myContext, ArrayList<SortS> myArrayList_SortS,
			RadioGroup myRadioGroup, ListView myListView) {
		super();
		this.myContext = myContext;
		this.myArrayList_SortS = myArrayList_SortS;
		this.myRadioGroup = myRadioGroup;
		this.myListView = myListView;
		url = (String) myContext.getResources().getText(R.string.url);
		
		//添加 更多按钮
		//createMore();
		
		
		 
		
		
		
	}

	public CreateDaoHang() {
		super();
	}

	// 获取导航条 ArrayList<SortS>
	@SuppressWarnings("static-access")
	public static ArrayList<SortS> getSortList(String url, String moban,
			String start, int s, String end, int d) {

		ArrayList<SortS> listSorts = new ArrayList<SortS>();

		List<String[]> l = new ArrayList<String[]>();
		StringResolution sr = new StringResolution();
		GetSource gs = new GetSource();
		//////long a = new Date().getTime();
		String source = gs.getSource(url, "gbk", 50);
		/////System.out.println("输出时间间隔：：：：：：：：：：：：" + (new Date().getTime() - a));
		if (!source.equals("") && !(source == null)) {
			l = sr.sourceToList(source, moban, start, s, end, d);
			for (int i = 0; i < l.size(); i++) {
				// System.out.println(l.get(i).length);
				/*
				 * for(int j=0;j<l.get(i).length;j++){
				 * System.out.println(l.get(i)[j] ); }
				 */
				SortS s1 = new SortS(l.get(i)[0], l.get(i)[1]);
				listSorts.add(s1);
			}
			return listSorts;
		} else {
			return null;
		}

	}
	/**
	 * 创建导航条
	 * @param sign
	 */
	public void createDH(final int sign) {
		// /////////////////////System.out.println("CreateDaoHang中获取的TitleName:"+TitleName);
		//为 下一页 做准备 的一个参数
		//Biaoji=sign;
		
		
		myView = new View(myContext);
		// 清空myRadioGroup数据
		myRadioGroup.removeAllViews();
		for (int i = 0; i < myArrayList_SortS.size(); i++) {
			SortS s1 = myArrayList_SortS.get(i);
			LayoutInflater li = LayoutInflater.from(myContext);
			myView = li.inflate(R.layout.nei_dh, null);
			myRadioButton = (RadioButton) myView.findViewById(R.id.rB_Items);
			myRadioButton.setText(s1.getSortName());
			myRadioButton.setId(i);
			if (sign == 0) {
				if (i == 0) {
					myRadioButton.setChecked(true);
					FindFristData(myRadioButton.getText().toString(), url
							+ myArrayList_SortS.get(0).getUrl(), zx_moban,
							zx_start, zx_s, zx_end, zx_d, zx_num1, zx_num2,
							zx_xml_id, myListView);
				}
			}
			if (sign == 1) {
				if (i == 0) {
					myRadioButton.setChecked(true);
					FindFristData(myRadioButton.getText().toString(), url
							+ myArrayList_SortS.get(0).getUrl(), wd_moban,
							wd_start, wd_s, wd_end, wd_d, wd_num1, wd_num2,
							wd_xml_id, myListView);
				}
			}
			if (sign == 2) {
				if (i == 0) {
					myRadioButton.setChecked(true);
					FindFristData(myRadioButton.getText().toString(), url
							+ myArrayList_SortS.get(0).getUrl(), jg_moban,
							jg_start, jg_s, jg_end, jg_d, jg_num1, jg_num2,
							jg_xml_id, myListView);
				}
			}
			myRadioGroup.addView(myView, i);
		}
		// RadioGroup的监听器
		myRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			public void onCheckedChanged(RadioGroup group, int checkedId) {
				// TODO Auto-generated method stub
				myHandler.post(new myRunnable(checkedId, sign));
			}
		});

	}

	// 线程处理
	private class myRunnable implements Runnable {
		private int id;
		private int sign;

		public myRunnable(int id, int sign) {
			super();
			this.sign = sign;
			this.id = id;
		}

		public void run() {
			// TODO Auto-generated method stub
			
			if (sign == 0) {
				FindFristData(myRadioButton.getText().toString(), url
						+ myArrayList_SortS.get(id).getUrl(), zx_moban,
						zx_start, zx_s, zx_end, zx_d, zx_num1, zx_num2,
						zx_xml_id, myListView);
			}
			if (sign == 1) {
				FindFristData(myRadioButton.getText().toString(), url
						+ myArrayList_SortS.get(id).getUrl(), wd_moban,
						wd_start, wd_s, wd_end, wd_d, wd_num1, wd_num2,
						wd_xml_id, myListView);
			}
			if (sign == 2) {
				FindFristData(myRadioButton.getText().toString(), url
						+ myArrayList_SortS.get(id).getUrl(), jg_moban,
						jg_start, jg_s, jg_end, jg_d, jg_num1, jg_num2,
						jg_xml_id, myListView);
			}
			Toast.makeText(myContext, "数据加载完成", Toast.LENGTH_SHORT).show();
		}

	}

	/**
	 * **********************获取“最新资讯”的“新闻标题”数据********************************
	 * 
	 * @param url
	 *            截取页面的url
	 * @param moban
	 *            获取有用信息的 正则表达式（自己写）
	 * @param start
	 *            截取区域的开头
	 * @param s
	 *            标记当前 start 在页面中是第几次出现
	 * @param end
	 *            截取区域的结尾
	 * @param d
	 *            标记当前 end 在页面中是第几次出现
	 * @return
	 */

	@SuppressWarnings("static-access")
	public ArrayList<String[]> GetNewSList(String url, String moban, String start,
			int s, String end, int d) {
		List<String[]> l = new ArrayList<String[]>();
		StringResolution sr = new StringResolution();
		GetSource gs = new GetSource();
		String source = gs.getSource(url, "gbk", 5);
		l = sr.sourceToList(source, moban, start, s, end, d);
		////String[][] str3 = new String[l.size()][l.get(0).length];
		/*for (int i = 0; i < l.size(); i++) {
			for (int j = 0; j < l.get(i).length; j++) {
				str3[i][j] = l.get(i)[j].replaceAll("<.*?>|\\s*|.*?>", "");
			}
		}*/
		return (ArrayList<String[]>) l;
				///str3;
	}
	/**
	 * 测试用的   滚动用的 
	 * @param url
	 * @param moban
	 * @param start
	 * @param s
	 * @param end
	 * @param d
	 * @return
	 */
	
	@SuppressWarnings("static-access")
	public ArrayList<String[]> GetNewSListTest(String url, String moban, String start,
			int s, String end, int d) {
		List<String[]> l = new ArrayList<String[]>();
		StringResolution sr = new StringResolution();
		GetSource gs = new GetSource();
		String source = gs.getSource(url, "gbk", 5);
		l = sr.sourceToList(source, moban, start, s, end, d);
		String[][] str3 = new String[l.size()][l.get(0).length];
		for (int i = 0; i < l.size(); i++) {
			for (int j = 0; j < l.get(i).length; j++) {
				str3[i][j] = l.get(i)[j].replaceAll("<.*?>|\\s*|.*?>", "");
			}
		}
		return (ArrayList<String[]>) l;
	}
	
	
	
	/**
	 * 获取上一页 ，下一页 
	 * 这里的数组用【0】【0】 因为这类只找到一个数据
	 * @param url
	 * @param moban
	 * @return
	 */
	@SuppressWarnings("static-access")
	public String GetMoreUrl(String url, String moban) {
		List<String[]> l = new ArrayList<String[]>();
		StringResolution sr = new StringResolution();
		GetSource gs = new GetSource();
		String source = gs.getSource(url, "gbk", 5);
		l = sr.sourceToList(source, moban);
		if (l.size() != 0) {
			return l.get(0)[0];
		} else {
			return null;
		}

	}

	/**
	 * 最新资讯 公司介绍，加盟我们，服务项目 的 listview 点击 获取内容 （例如：新闻内容）
	 * 
	 * @param url
	 *            截取页面的url
	 * @param start
	 *            截取区域的开头
	 * @param end
	 *            截取区域的结尾
	 * @param moban
	 *            获取有用信息的 正则表达式（自己写）
	 * @return
	 */
	@SuppressWarnings("static-access")
	public static String getListContent(String url, String start, String end,
			String moban) {
		GetSource gs = new GetSource();
		StringResolution sr = new StringResolution();
		String source = gs.getSource(url, "gbk", 5);
		source = source.replaceAll("<BR.*?>|<br.*?>", "\n");
		
		String str = sr.sourceToContent(source, start, end, moban);
		return str;
	}

	/**
	 * 最新资讯 NeiActivity的头部导航RadioButton的点击事件处理 url RadioButton对应的 网页地址 moban
	 * 抓取用到的模板 start 抓取范围的开始 位置 s 标记当前 start 在页面中是第几次出现 end 抓取范围的结束 位置 d 标记当前
	 * end 在页面中是第几次出现 Num1 ListView 第一个要显示的文字 在 数组中的位置 Num2 ListView 第二个要现实的文字
	 * 在数组中的位置 XmlNum ListView的items要配备的 xml布局文件的ID
	 * 
	 * @author Administrator
	 * 
	 */
	private void FindFristData(final String titleName, final String url2,
			String moban, String start, int s, String end, int d, int num1,
			int num2, final int xmlNum, final ListView myListView) {
		
			
		try {
			//MoreUrl=url2;
			
			strV= GetNewSList(url2, moban, start, s, end, d);
			
			myList_Adapter=new List_Adapter(myContext, strV, num1, num2, xmlNum);

			myListView.setAdapter(myList_Adapter);
			
			myListView.setOnScrollListener(this);
			
			myListView.setOnItemClickListener(new OnItemClickListener() {
				
				public void onItemClick(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					// TODO Auto-generated method stub
					if (xmlNum == R.layout.nei_list_items) {
						Intent myIntent = new Intent(myContext,
								ContentActivity.class);
						myIntent.putExtra("Title", titleName);
						myIntent.putExtra("start",
								"<td height=\"50\" valign=\"bottom\">");
						myIntent.putExtra("end", "<td><hr></td>");
						myIntent.putExtra("moban",
								"<a.*?>|</a>|<A.*?>|<.*?>|&nbsp;");
						myIntent.putExtra("Con", url + strV.get(arg2)[0]);
						myContext.startActivity(myIntent);
					}
					if (xmlNum == R.layout.list_lists_items) {
						Intent myIntent = new Intent(myContext,
								ShopContentActivity.class);
						myIntent.putExtra("Title", strV.get(arg2)[3].toString());
						myIntent.putExtra("Address", strV.get(arg2)[0].toString());
						myIntent.putExtra("Num", strV.get(arg2)[1].toString());
						myIntent.putExtra("Url", strV.get(arg2)[2].toString());
						myContext.startActivity(myIntent);
					}
					if (xmlNum == R.layout.values_lists_items) {
					}
				}
			});
		} catch (Exception e) {
			// TODO: handle exception
			new AlertDialog.Builder(myContext)
					.setTitle("网络信号异常")
					.setMessage("请查看网络连接，请稍后再试...")
					.setPositiveButton("确定",
							new DialogInterface.OnClickListener() {
								public void onClick(DialogInterface dialog,
										int which) {
									dialog.cancel();
								}
							}).show();
		}

	}

	public void onScroll(AbsListView view, int firstVisibleItem,
			int visibleItemCount, int totalItemCount) {
		// TODO Auto-generated method stub
	}

	public void onScrollStateChanged(AbsListView view, int scrollState) {
		/*
		if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
			mProgressBar.setVisibility(View.VISIBLE);
			mTextView.setVisibility(View.GONE);
			myHandler.postDelayed(new Runnable() {

				public void run() {
					// TODO Auto-generated method stub
					mProgressBar.setVisibility(View.GONE);
					mTextView.setVisibility(View.VISIBLE);
				}
			}, 2000);
			try {
				MoreUrl = GetMoreUrl(MoreUrl, "<A HREF=&need;>下一页</A>");
				ArrayList<String[]> StrVList = null;
				if (Biaoji == 0) {
					StrVList = GetNewSList(MoreUrl, zx_moban, zx_start, zx_s,
							zx_end, zx_d);
				}
				if (Biaoji == 1) {
					StrVList = GetNewSList(MoreUrl, wd_moban, wd_start, wd_s,
							wd_end, wd_d);
				}
				if (Biaoji == 2) {
					StrVList = GetNewSList(MoreUrl, jg_moban, jg_start, jg_s,
							jg_end, jg_d);
				}

				for (int i = 0; i < StrVList.size(); i++) {

					strV.add(StrVList.get(i));
				}
				myList_Adapter.notifyDataSetChanged();

			} catch (Exception e) {
				// TODO: handle exception
				Toast.makeText(myContext, "数据已经加载完成", Toast.LENGTH_LONG).show();
			}
		}
		*/
		
		// TODO Auto-generated method stub
		 /*this.scrollState = scrollState;
		 boolean b=(MoreUrl==null||"".equals(MoreUrl));
		 System.out.println("ScrollStateChanged中****MoreUrl*****"+MoreUrl);
		 if(scrollState==OnScrollListener.SCROLL_STATE_IDLE&&!b){
			 
			 System.out.println("ScrollStateChanged中******得到地步文件编号****"+myListView.getFooterViewsCount());
			 if(myListView.getFooterViewsCount()==0){
				 myListView.addFooterView(MoreView);
			 }
			 System.out.println("ScrollStateChanged中******得到地步文件编号*-**添加之后****"+myListView.getFooterViewsCount());*/
			 
			 /*ArrayList<String[]> StrVList=GetNewSList(MoreUrl, wd_moban,
						wd_start, wd_s,
						wd_end, wd_d);
				int a=myList_Adapter.getCount();
				for(int i=0;i<StrVList.size();i++){
					myList_Adapter.notifyDataSetChanged();
					strV.add(StrVList.get(i));
				}
             /////myList_Adapter.notifyDataSetChanged();
             myListView.setSelection(a-1);
             // 获取数据成功时把Layout设为不可见，把Button设为可见
             mProgressLoadLayout.setVisibility(View.GONE);
             MoreButton.setVisibility(View.VISIBLE);
             
             MoreUrl=GetMoreUrl(MoreUrl, "<A HREF=&need;>下一页</A>");
				if(MoreUrl==null||"".equals(MoreUrl)){
					myListView.removeFooterView(mLoadLayout);
				}*/
		 /*}else{
			 System.out.println("移除地步的footer.............."+myListView.removeFooterView(MoreView));
			 
		 }*/
		 
	}
	
	
	//////为 listview添加 更多加载的控件
	//private void  createMore(){
		/*
        MoreButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
					mProgressLoadLayout.setVisibility(View.VISIBLE);
					MoreButton.setVisibility(View.GONE);
					if (MoreUrl!=null||!("".equals(MoreUrl))) {
                        myHandler.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                            	ArrayList<String[]> StrVList=GetNewSList(MoreUrl, wd_moban,
                						wd_start, wd_s,
                						wd_end, wd_d);
                				int a=myList_Adapter.getCount();
                				for(int i=0;i<StrVList.size();i++){
                					myList_Adapter.notifyDataSetChanged();
                					strV.add(StrVList.get(i));
                				}
                                /////myList_Adapter.notifyDataSetChanged();
                                myListView.setSelection(a-1);
                                // 获取数据成功时把Layout设为不可见，把Button设为可见
                                mProgressLoadLayout.setVisibility(View.GONE);
                                MoreButton.setVisibility(View.VISIBLE);
                                
                                MoreUrl=GetMoreUrl(MoreUrl, "<A HREF=&need;>下一页</A>");
                				if(MoreUrl==null||"".equals(MoreUrl)){
                					myListView.removeFooterView(mLoadLayout);
                				}
                            }
                        }, 2000);
                    }else{
                    	mProgressLoadLayout.setVisibility(View.GONE);
                    	MoreButton.setVisibility(View.VISIBLE);
                        myListView.removeFooterView(mLoadLayout);
                    }
				}
			}
			
		});
        myListView.addFooterView(mLoadLayout);*/
		
		
		
	//	MoreView=new View(myContext);
		
	//	LayoutInflater li = LayoutInflater.from(myContext);
	//	MoreView=li.inflate(R.layout.more_down, null);
	//	mProgressBar=(ProgressBar)MoreView.findViewById(R.id.progressBar1);
	//	mTextView=(TextView)MoreView.findViewById(R.id.textView1);
	//	mProgressBar.setVisibility(View.GONE);
	//	mTextView.setVisibility(View.VISIBLE);
		/*mTextView.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				mProgressBar.setVisibility(View.VISIBLE);
				mTextView.setVisibility(View.GONE);
				myHandler.postDelayed(new Runnable() {
					
					@Override
					public void run() {
						// TODO Auto-generated method stub
						mProgressBar.setVisibility(View.GONE);
						mTextView.setVisibility(View.VISIBLE);
					}
				}, 2000);
				
			}
		});*/
		
	//	myListView.addFooterView(MoreView);
		
	//}
	//
	
	
	
}
	/**
	 *************************以下代码  在项目中没有用到****************************************************
	 */
	
	/*//洗涤价格 事件处理////////////////////////////////////////////////////////////////////////
	private class myValuesOnClickListener implements OnClickListener{
		String url;String moban;String start;int s;String end;int d;
		
		public myValuesOnClickListener(String url, String moban, String start, int s,
				String end, int d) {
			super();
			this.url = url;
			this.moban = moban;
			this.start = start;
			this.s = s;
			this.end = end;
			this.d = d;
		}

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			////////////////System.out.println("myFUOnClickListener中获取到的数据连接地址："+url);
			 final ArrayList<PriceS> priceS_List=GetPriceSList(url, moban, start, s, end, d);
			myListView.setAdapter(new Values_List_Adapter(myContext,priceS_List ));
			myListView.setOnItemClickListener(new OnItemClickListener() {

				@Override
				public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
						long arg3) {
					// TODO Auto-generated method stub
					Intent myIntent=new Intent(myContext, ContentActivity.class);
					myIntent.putExtra("Title",priceS_List.get(arg2).getClothesName().toString());
					myIntent.putExtra("Con",priceS_List.get(arg2).getClothesValue().toString());
							//getNewContent(shops_List.get(arg2).getShopUrl().toString()).replaceAll("\\s{2,}", "\n").replaceFirst("\\s{1,}", "\n\n"));
					myContext.startActivity(myIntent);
				}
			});
		}
		
	}*/
	/*//为     洗涤价格配备    listView数据
	public ArrayList<PriceS> GetPriceSList(String url,String moban,String start,int s,String end,int d){
		ArrayList<PriceS> getArrayList_PriceS=new ArrayList<PriceS>();
		List<String[]> l = new ArrayList<String[]>();
		StringResolution sr = new StringResolution();
		GetSource gs = new GetSource();
		String source = gs.getSource(url, "gbk");
		l = sr.sourceToList(source, moban,start,s,end,d);
	       
		/////////////////////////System.out.println("获取调集值BIAOJI:::::"+BIAOJI);
		for(int i=0;i<l.size();i++){
			for(int j=0;j<l.get(i).length;j++){
				System.out.println(l.get(i)[j]+"			"	);
			}
			
			PriceS price1=new PriceS(l.get(i)[0].replaceAll("<.*?>|\\s*|.*?>", ""), l.get(i)[1].replaceAll("<.*?>|\\s*|.*?>", ""));
			getArrayList_PriceS.add(price1);
			///////////////////////System.out.println(price1.toString());
			/////////////////////////System.out.println(shop1.toString());
		}
		return getArrayList_PriceS;
		//return getArrayList_PriceS;
	}*/
	
	/*RadioGroup的OnCheckedChangerListener （在该项目中不适合）
	 * private class MyOnCheckedChangeListener implements RadioGroup.OnCheckedChangeListener{
		String titleName;ArrayList<SortS> sorts_List;String moban;String start;int s;String end;int d,Num1,Num2,XmlNum;
		
		public MyOnCheckedChangeListener( ArrayList<SortS> sorts_list,
				String moban, String start, int s, String end, int d, int num1,
				int num2, int xmlNum) {
			super();
			//this.titleName = titleName;
			this.sorts_List = sorts_list;
			this.moban = moban;
			this.start = start;
			this.s = s;
			this.end = end;
			this.d = d;
			Num1 = num1;
			Num2 = num2;
			XmlNum = xmlNum;
		}

		@Override
		public void onCheckedChanged(RadioGroup group, int checkedId) {
			// TODO Auto-generated method stub
			for(int i=0;i<sorts_List.size();i++){
				if(i==checkedId){
					
					final String[][] strV=GetNewSList(url+sorts_List.get(i).getUrl(), moban, start, s, end, d);
					myListView.setAdapter(new List_Adapter(myContext,strV,Num1,Num2,XmlNum));
					myListView.setOnItemClickListener(new OnItemClickListener() {
						@Override
						public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
								long arg3) {
							// TODO Auto-generated method stub
							 if(XmlNum==R.layout.nei_list_items){
								 Intent myIntent=new Intent(myContext, ContentActivity.class);
									myIntent.putExtra("Title",titleName);
									myIntent.putExtra("start", "<td height=\"50\" valign=\"bottom\">");
									myIntent.putExtra("end", "<td><hr></td>");
									myIntent.putExtra("moban", "<a.*?>|</a>|<A.*?>|<.*?>|&nbsp;");
									myIntent.putExtra("Con",url+strV[arg2][0]);
									myContext.startActivity(myIntent);
							 }
						}
					});
				}
			}
		}
		
	}*/
/**
 * RadioButton 点击时间处理，和listview的数据配备，和适配器
 */

/*private class myOnClickListener implements OnClickListener{
	
	String titleName;String url2;String moban;String start;int s;String end;int d,Num1,Num2,XmlNum;
	public myOnClickListener(String titleName,String url, String moban, String start, int s,
			String end, int d,int num1,int num2,int xmlNum) {
		super();
		this.titleName=titleName;
		this.url2 = url;
		this.moban = moban;
		this.start = start;
		this.s = s;
		this.end = end;
		this.d = d;
		this.Num1=num1;
		this.Num2=num2;
		this.XmlNum=xmlNum;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		try {
		final String[][] strV=GetNewSList(url2, moban, start, s, end, d);
		////////myListView.setAdapter(new List_Adapter(myContext,news_List ));
		myListView.setAdapter(new List_Adapter(myContext,strV,Num1,Num2,XmlNum));
		myListView.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
				 if(XmlNum==R.layout.nei_list_items){
					 Intent myIntent=new Intent(myContext, ContentActivity.class);
						myIntent.putExtra("Title",titleName);
						myIntent.putExtra("start", "<td height=\"50\" valign=\"bottom\">");
						myIntent.putExtra("end", "<td><hr></td>");
						myIntent.putExtra("moban", "<a.*?>|</a>|<A.*?>|<.*?>|&nbsp;");
						myIntent.putExtra("Con",url+strV[arg2][0]);
						myContext.startActivity(myIntent);
				 }
				 if(XmlNum==R.layout.list_lists_items){
					 Intent myIntent=new Intent(myContext, ShopContentActivity.class);
						myIntent.putExtra("Title",strV[arg2][3].toString());
						myIntent.putExtra("Address", strV[arg2][0].toString());
						myIntent.putExtra("Num", strV[arg2][1].toString());
						myIntent.putExtra("Url",strV[arg2][2].toString());
						myContext.startActivity(myIntent);
				 }
				 if(XmlNum==R.layout.values_lists_items){
				 }
				 
				
				
			}
		});
		
		} catch (Exception e) {
			// TODO: handle exception
			new AlertDialog.Builder(myContext)
			.setTitle("网络信号异常")
			.setMessage("查看网络连接，请稍后再试...")
			.setPositiveButton("确定",
					new DialogInterface.OnClickListener() {
						public void onClick(DialogInterface dialog,
								int which) {
							
							System.exit(0);
						}
					}).show();
		}
		
		
		
		
		
	}
	
}*/




	
	


